<form action=add_user.php method=post>
	Username: <input type=text name=username size=25 /><br /> Password: <input
		type=password name=password size=25 /><br /> Re-Password: <input
		type=password name=re-password size=25 /><br /> Class: <select
		name="class">
		<option value="1">1</option>
		<option value="2">2</option>
	</select> <br /> <input type=submit name=adduser value="Add" />
</form>
<?php
if (isset ( $_POST ['adduser'] )) {
	if ($_POST ['username'] == "") {
		echo "Vui long nhap username<br />";
	} else {
		$u = $_POST ['username'];
	}
	if ($_POST ['password'] != $_POST ['re-password']) {
		echo "Password va re-password khong chinh xac<br />";
	} else {
		if ($_POST ['password'] == "") {
			echo "Vui long nhap password<br />";
		} else {
			$p = $_POST ['password'];
		}
	}
	$c = $_POST ['class'];
}
if ($u & $p & $c) {
	$conn = mysql_connect ( "localhost", "root", "" ) or die ( "can't connect this database" );
	mysql_select_db ( "demo_mysql", $conn );
	$sql = "select * from user where username='" . $u . "'";
	$query = mysql_query ( $sql );
	if (mysql_num_rows ( $query ) != "") {
		echo "Username nay da ton tai roi<br />";
	} else {
		$sql2 = "insert into user(username,password,class) values('" . $u . "','" . $p . "','" . $c . "')";
		$query2 = mysql_query ( $sql2 );
		header ("Location:list.php");
		echo "Da them thanh vien moi thanh cong";
	}
}
?>